import request from '@/utils/request'

// 聊天相关 API
export const chatAPI = {
  // 发送消息
  sendMessage(message, conversationId = null) {
    return request.post('/chat/send', { message, conversationId })
  },

  // 流式发送消息
  streamMessage(message, conversationId = null) {
    return request.post('/chat/stream', { message, conversationId }, {
      responseType: 'stream'
    })
  },

  // 获取对话历史
  getChatHistory(conversationId = null) {
    return request.get('/chat/history', {
      params: { conversationId }
    })
  },

  // 获取对话列表
  getConversations() {
    return request.get('/chat/conversations')
  },

  // 删除对话
  deleteConversation(conversationId) {
    return request.delete(`/chat/conversations/${conversationId}`)
  },

  // 清空对话历史
  clearChatHistory(conversationId = null) {
    return request.delete('/chat/history', {
      params: { conversationId }
    })
  }
}


